/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projectshanghai;

import java.awt.Dimension;
import javax.vecmath.Point2d;

/**
 *
 * @author Eric-Standard
 */
public class Camera extends Point2d {

    private World world;

    public Camera(World world) {
        super();
        this.world = world;
    }

    /**
     * Moves the camera to in bounds of the panel.
     */
    public void moveToBounds() {
        Dimension size = world.getMapSize();
        if (x > size.width - GamePanel.PANEL_WIDTH) {
            x = size.width - GamePanel.PANEL_WIDTH;
        }
        if (y > size.height - GamePanel.PANEL_HEIGHT) {
            y = size.height - GamePanel.PANEL_HEIGHT;
        }
        this.clampMin(0);
    }
}
